bitkeeper revision 1.1159.69.7 (41394659gzch_AlptZgctoWrGnWAGw)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Sat, 4 Sep 2004 04:36:41 +0000 (04:36 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Sat, 4 Sep 2004 04:36:41 +0000 (04:36 +0000)
Fix WBINVD by adding a new hypercall.
Various drivers still use wbinvd directly rather than using the
helper macro in system.h. They should be fixed by sending patches
to the appropriate maintainers (e.g., DRM, AGP, ...).

linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/system.h
xen/arch/x86/memory.c
xen/include/hypervisor-ifs/dom0_ops.h
xen/include/hypervisor-ifs/hypervisor-if.h

index 822c57f29aefddc8aa39fb4c438778960a4234cd..133f1eaf4986d4674d45093e53136a1d57eeca1c 100644 (file)
@@ -122,9 +122,13 @@ static inline unsigned long _get_base(char * addr)
 
 #endif /* __KERNEL__ */
 
-#define wbinvd() \
-       BUG();
-//     __asm__ __volatile__ ("wbinvd": : :"memory");
+static inline void wbinvd(void)
+{
+    mmu_update_t u;
+    u.ptr = MMU_EXTENDED_COMMAND;
+    u.val = MMUEXT_FLUSH_CACHE;
+    (void)HYPERVISOR_mmu_update(&u, 1, NULL);
+}
 
 static inline unsigned long get_limit(unsigned long segment)
 {
index 5d95bea71e0ac987b1039f55c44620e86f428ec5..35a248a50d8308ff124e959b57a41d7ffa5d021a 100644 (file)
@@ -905,6 +905,18 @@ static int do_extended_command(unsigned long ptr, unsigned long val)
         __flush_tlb_one(ptr);
         break;
 
+    case MMUEXT_FLUSH_CACHE:
+        if ( unlikely(!IS_CAPABLE_PHYSDEV(d)) )
+        {
+            MEM_LOG("Non-physdev domain tried to FLUSH_CACHE.\n");
+            okay = 0;
+        }
+        else
+        {
+            wbinvd();
+        }
+        break;
+
     case MMUEXT_SET_LDT:
     {
         unsigned long ents = val >> MMUEXT_CMD_SHIFT;
index 7dec0af739aace81716523b0c9ddf6f09a8dd0c6..ebac7397bd68577a427877e8324a13cd465a942d 100644 (file)
@@ -19,7 +19,7 @@
  * This makes sure that old versions of dom0 tools will stop working in a
  * well-defined way (rather than crashing the machine, for instance).
  */
-#define DOM0_INTERFACE_VERSION   0xAAAA0012
+#define DOM0_INTERFACE_VERSION   0xAAAA0013
 
 #define MAX_DOMAIN_NAME    16
 
index 36528bfda45fc0d723b943589780fae6d629829c..2b9f8c7166f9b8725028a33f22c641e1a5bf22f0 100644 (file)
  *   val[7:0] == MMUEXT_INVLPG:
  *   ptr[:2]  -- Linear address to be flushed from the TLB.
  * 
+ *   val[7:0] == MMUEXT_FLUSH_CACHE:
+ *   No additional arguments. Writes back and flushes cache contents.
+ * 
  *   val[7:0] == MMUEXT_SET_LDT:
  *   ptr[:2]  -- Linear address of LDT base (NB. must be page-aligned).
  *   val[:8]  -- Number of entries in LDT.
 #define MMU_MACHPHYS_UPDATE      2 /* ptr = MA of frame to modify entry for  */
 #define MMU_EXTENDED_COMMAND     3 /* least 8 bits of val demux further      */
 #define MMUEXT_PIN_TABLE         0 /* ptr = MA of frame to pin               */
-#define MMUEXT_UNPIN_TABLE       4 /* ptr = MA of frame to unpin             */
-#define MMUEXT_NEW_BASEPTR       5 /* ptr = MA of new pagetable base         */
-#define MMUEXT_TLB_FLUSH         6 /* ptr = NULL                             */
-#define MMUEXT_INVLPG            7 /* ptr = VA to invalidate                 */
-#define MMUEXT_SET_LDT           8 /* ptr = VA of table; val = # entries     */
+#define MMUEXT_UNPIN_TABLE       1 /* ptr = MA of frame to unpin             */
+#define MMUEXT_NEW_BASEPTR       2 /* ptr = MA of new pagetable base         */
+#define MMUEXT_TLB_FLUSH         3 /* ptr = NULL                             */
+#define MMUEXT_INVLPG            4 /* ptr = VA to invalidate                 */
+#define MMUEXT_FLUSH_CACHE       5
+#define MMUEXT_SET_LDT           6 /* ptr = VA of table; val = # entries     */
+#define MMUEXT_SET_FOREIGNDOM    7 /* val[31:16] = dom                       */
+#define MMUEXT_CLEAR_FOREIGNDOM  8
 #define MMUEXT_TRANSFER_PAGE     9 /* ptr = MA of frame; val[31:16] = dom    */
-#define MMUEXT_SET_FOREIGNDOM   10 /* val[31:16] = dom                       */
-#define MMUEXT_CLEAR_FOREIGNDOM 11
-#define MMUEXT_REASSIGN_PAGE    12
+#define MMUEXT_REASSIGN_PAGE    10
 #define MMUEXT_CMD_MASK        255
 #define MMUEXT_CMD_SHIFT         8